#include "apue.h"
#include <fcntl.h>

// 用户、组、其他用户具有读写权限
#define RWRWRW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
 // 屏蔽新创建的文件的组用户其他用户读写权限位
#define __RWRW (S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)

int main(void) {
    umask(0);
    if (creat("foo", RWRWRW) < 0)
        err_sys("create error for foo");
    umask(__RWRW);
    if (creat("bar", RWRWRW) < 0)
        err_sys("create error for bar");
    return 0;
}